<div class="bjui-pageHeader">
    <div class="pull-right">
        <button class="btn-default" data-icon="refresh" onclick="$.CurrentNavtab.navtab('refresh')"></button>
    </div>
</div>
<div class="bjui-pageContent tableContent">
    <div class="phone_menu" >
        <div class="phone_bg">
            <div class="wx_menu">
                <span class="keybar"></span>
                <div class="menus">
                    <volist name="list" id="vo">
                    <div class="menulist">
                        <div class="menulist-title" data-id="{$vo.id}">
	                         <if condition="$vo.sub_button neq null">
	                            <img src="__PU__/images/menulisticon.png" alt="" />
	                         </if>
                             {$vo.name}
                        </div>
                        <if condition="$vo.sub_button neq null">
                        <div class="menulist-sub">
                            <div class="sub_menu_inner">
                            <volist name="vo['sub_button']" id="so" key="k">
                                <div data-id="{$vo.id}_{$so.id}">{$so.name}</div>
                            </volist>
                            </div>
                            <em></em>
                        </div>
                        </if>
                    </div>
                    </volist>
                </div>
            </div>
        </div>
    </div>

    <div class="pull-left menu-content" style="padding-left:50px;padding-top:50px;">
        <table class="table table-bordered table-hover table-striped table-top" data-selected-multi="false">
                <thead>
                <tr >
                    <th colspan="2"><button class="btn-default" data-icon="plus" title="添加新菜单" data-toggle="tooltip" data-placement="left" onclick="createDialog('{:U("Wx/menu_two")}', '添加新菜单', 'add_wx_menu', {width:700, height:550})"></button></th>
                </tr>
                <tr>
                    <th width="400">菜单名称</th>
                    <th width="200">操作</th>
                </tr>
                </thead>
                <tbody>
                    <volist name="list" id="vo">
	                    <tr>
	                        <td>{$vo.name}</td>
	                        <td><button type="button" class="btn-green" onclick="createDialog('{:U("Wx/menu_two",array("id"=>$vo["id"]))}', '修改菜单', 'add_wx_menu', {width:700, height:550})">改</button><a href="{:U('Wx/del_wx_menu',array('id'=>$vo['id']))}" class="btn btn-red" data-toggle="doajax" data-confirm-msg="你确定要删除?" >删</a></td>
	                    </tr>
	                    <volist name="vo['sub_button']" id="so">
	                      <tr>
	                         <td style="padding-left: 2em;"><span>{$so.name}</span></td>
	                         <td><button type="button" class="btn-green" onclick="createDialog('{:U("Wx/menu_two",array("id"=>$so["id"]))}', '修改菜单', 'add_wx_menu', {width:700, height:550})">改</button><a href="{:U('wx/del_wx_menu',array('id'=>$so['id']))}" data-type="get" class="btn btn-red" data-toggle="doajax" data-confirm-msg="你确定要删除?" >删</a></td>
	                      </tr>
	                    </volist>
                    </volist>
                </tbody>
            </table>
    </div>
    <div><a href="{:U('Wx/sub_wx_menu')}" class="btn btn-green" data-toggle="doajax" data-confirm-msg="你确定要发布吗?" >发布</a></div>
</div>

<script>
    $(function () {
        $('.menulist').each(function () {
            var _this =  $(this).find('.menulist-sub');
            var sub_width = _this.outerWidth();
            var outWidth = _this.prev('.menulist-title').outerWidth();
            if( sub_width > outWidth ){
                var lf = -((sub_width-outWidth)/2);
            }else{
                var lf = (outWidth-sub_width)/2;
            }
            _this.css({
                left:lf
            });
        });
    });
</script>
